#include <iostream>
#include "vectorfunctions.h"
int myintersection(int x[], int y[], int m, int n, int u[])
{
	int i, length=0, l;
	if(m>n){
		l=m;
		for(i=0; i<l; i++)
			if(no_in_vector(y, n, x[i])>=0){
				u[length]=x[i];
				++length;
			}
	}
	else {
		l=n;
		for(i=0; i<l; i++)
			if(no_in_vector(x, m, y[i])>=0){
				u[length]=y[i];
				++length;
			}		
	}
			
return length;
}

int main()
{
	int m, n, l;
	int a[100], b[100], u[100];
	cout<<"Length of set A : ";
	cin>>m;
	readVector(a, m);
	cout<<"Length of set B : ";
	cin>>n;
	readVector(b, n);
	l= myintersection(a, b, m, n, u);
	printVector(u, l);
return 0;
}

